package chap3_14;

import java.util.Arrays;

public class Exer3_14_4 {
    public static void main(String[] args) {
        int[]arr={3,2,4,1};
        int[]sub={0,1,2,3};
        int min;
        for(int i=0;i<arr.length-1;i++){
            if(arr[i]>arr[i+1]){
                min=arr[i];
                arr[i]=arr[i+1];
                arr[i+1]=min;
                min=sub[i];
                sub[i]=sub[i+1];
                sub[i+1]=min;
            }
        }
        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.toString(sub));

    }
}
